﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DesignPatterns
{
    public abstract class AbstractFactory
    {
        /// <summary>
        /// 发货
        /// </summary>
        /// <returns></returns>
        public abstract SendGood SendGood();

    }

    /// <summary>
    /// 取货 抽象类
    /// </summary>
    public abstract class SendGood
    {
        public abstract void GetGood();
    }


    /// <summary>
    /// 公司A抽象工厂
    /// </summary>
    public class CompanyAAbstractFactory : AbstractFactory
    {
        public override SendGood SendGood()
        {
            return new CompanyAGetGood();
        }
    }

    /// <summary>
    /// 公司B的抽象工厂
    /// </summary>
    public class CompanyBAbstractFactory : AbstractFactory
    {
        public override SendGood SendGood()
        {
            return new CompanyBGetGood();
        }
    }

    public class CompanyAGetGood : SendGood
    {
        public override void GetGood()
        {
            Console.WriteLine("公司A 取货");
        }
    }

    public class CompanyBGetGood : SendGood
    {
        public override void GetGood()
        {
            Console.WriteLine("公司B 取货");
        }
    }

}
